#!/usr/bin/env python
#    prop_ctocd
#    ----------
#    Molecule:         H2O
#    Wave Function:    SCF
#    Test Purpose:     Calculation of CTOCD-DZ magnetizability and
# 	             shielding constants through ABACUS

import os
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from runtest_dalton import Filter, TestRun

test = TestRun(__file__, sys.argv)

f = Filter()

f.add(from_string = 'Atoms and basis sets',
      num_lines = 15,
      rel_tolerance = 1.0e-2)

f.add(from_string = 'Cartesian Coordinates',
      num_lines = 10,
      rel_tolerance = 1.0e-8)

f.add(string = 'Number of coordinates in each symmetry',
      rel_tolerance = 1.0e-2)
      
f.add(string = 'Number of orbitals in each symmetry',
      rel_tolerance = 1.0e-2)

f.add(string = 'Final HF energy',
      rel_tolerance = 1.0e-9)



f.add(string = 'Nuclear magnetic shieldings',
      rel_tolerance = 1.0e-2)
f.add(string = 'Magnetic susceptibilities',
      rel_tolerance = 1.0e-2)
f.add(string = 'Continuous Transformation of the Origin of the Current Density',
      rel_tolerance = 1.0e-2)
f.add(string = 'CTOCD-DZ Magnetic susceptibilities',
      rel_tolerance = 1.0e-2)
f.add(string = 'CTOCD-DZ Nuclear magnetic shieldings',
      rel_tolerance = 1.0e-2)
f.add(string = 'London orbitals are NOT used',
      rel_tolerance = 1.0e-2)


f.add(from_string = 'Magnetizabilities',
      num_lines = 9,
      mask = [2],
      abs_tolerance = 1.0e-3)

f.add(from_string = 'Total magnetizability tensor',
      num_lines = 9,
      abs_tolerance = 2.0e-5)

f.add(from_string = 'Diamagnetic magnetizability tensor',
      num_lines = 9,
      abs_tolerance = 2.0e-5)

f.add(from_string = 'Paramagnetic magnetizability tensor',
      num_lines = 9,
      abs_tolerance = 2.0e-5)

f.add(from_string = 'Shielding tensors in symmetry coordinates',
      num_lines = 24,
      rel_tolerance = 2.0e-5)

f.add(from_string = 'Chemical shielding for ',
      num_lines = 16,
      rel_tolerance = 2.0e-5)
f.add(from_string = 'Total shielding tensor',
      num_lines = 11,
      rel_tolerance = 2.0e-5)


f.add(string = 'Diamagnetic contribution:',
      abs_tolerance = 1.0e-3)



test.run(['prop_ctocd.dal'], ['H2O_intgrl_sym.mol'], f={'out': f})

sys.exit(test.return_code)
